﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

namespace WFL.Office.Word
{
    public class WordBookmark
    {
        private readonly object _lock = new object();

        public string Name
        {
            get { return _bookmark.Name; }
        }

        private WordRange _range;
        public WordRange Rang
        {
            get
            {
                if (_range == null)
                {
                    lock (_lock) { if (_range == null) { _range = new WordRange(_bookmark.Range) { Document = Document }; } }
                }
                return _range;
            }
        }

        private Bookmark _bookmark;

        public WordDocument Document
        {
            get;
            internal set;
        }

        internal WordBookmark(Bookmark bookmark)
        {
            _bookmark = bookmark;
        }
    }
}
